<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/datapicker/datepicker3.css}" rel="stylesheet"/>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-dayUser-edit" th:object="${dayUser}">
		<input id="cardUserId" name="cardUserId" th:field="*{cardUserId}"  type="hidden">
		<div class="form-group">
			<label class="col-sm-3 control-label">客户卡号：</label>
			<div class="col-sm-8">
				<input id="cardId" name="cardId" th:field="*{cardId}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">客户姓名：</label>
			<div class="col-sm-8">
				<input id="cardUserName" name="cardUserName" th:field="*{cardUserName}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">课程顾问：</label>
			<div class="col-sm-8">
				<input id="loginName" name="loginName" th:field="*{loginName}" class="form-control" type="text">
			</div>
		</div>
		<!--<div class="form-group">
			<label class="col-sm-3 control-label">邮箱：</label>
			<div class="col-sm-8">
				<input id="email" name="email" th:field="*{email}" class="form-control" type="text">
			</div>
		</div>-->
		<div class="form-group">
			<label class="col-sm-3 control-label">电话：</label>
			<div class="col-sm-8">
				<input id="phoneNumber" name="phoneNumber" th:field="*{phoneNumber}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">性别：</label>
			<!--<div class="col-sm-8">
				<select id="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
					<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
				</select>
			</div>-->
			<div class="col-sm-8">
				<select id="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
					<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{sex}"></option>
				</select>
			</div>
		</div>
		<!--<div class="form-group">
			<label class="col-sm-3 control-label">头像：</label>
			<div class="col-sm-8">
				<input id="avatar" name="avatar" th:field="*{avatar}" class="form-control" type="text">
			</div>
		</div>-->
		<div class="form-group">
			<label class="col-sm-3 control-label">课时数量：</label>
			<div class="col-sm-8">
				<input id="classCount" name="classCount" th:field="*{classCount}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">办卡类型：</label>
			<div class="col-sm-8">
				<!--<select id="cardStyle" class="form-control " th:with="type=${@dict.getType('attend_card')}">
					<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
				</select>-->
				<input id="cardStyle" name="classCount" th:field="*{cardStyle}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">课堂类型：</label>
			<div class="col-sm-8">
				<input id="classType" name="classType" th:field="*{classType}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">备注信息：</label>
			<div class="col-sm-8">
				<input id="remark" name="remark" th:field="*{remark}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">到期时间：</label>
			<div class="col-sm-8 " >
				<input id="pastTime" name="pastTime" th:field="*{pastTime}" class="form-control input-group date " type="text" >
			</div>
		</div>
		<!-- class 多写性-->
		<!--<div class="form-group">
			<label class="col-sm-3 control-label">创建时间：</label>
			<div class="col-sm-8">
				<input id="createTime" name="createTime" th:field="*{createTime}" class="time-input" type="text">
			</div>
		</div>-->
	</form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
    var prefix = ctx + "attend/dayUser"
    $("#form-dayUser-edit").validate({
        rules:{
            xxxx:{
                required:true,
            },
        }
    });

    function submitHandler() {
        if ($.validate.form()) {
           // $.operate.save(prefix + "/edit", $('#form-dayUser-edit').serialize());
            edit();
        }
    }
    function edit() {
         var cardUserId = $("input[name='cardUserId']").val();
        var cardUserName = $("input[name='cardUserName']").val();
        var loginName = $("input[name='loginName']").val();
        var cardId = $("input[name='cardId']").val();
        var email = $("input[name='email']").val();
        var phoneNumber = $("input[name='phoneNumber']").val();
        var attendCount = $("input[name='attendCount']").val();
        var classCount = $("input[name='classCount']").val();
        var classType = $("input[name='classType']").val();
        var remark = $("input[name='remark']").val();
        var pastTime = $("input[name='pastTime']").val();
        var sex = $("#sex option:selected").val();
        var cardStyle = $("#cardStyle option:selected").val();
        $.ajax({
            cache : true,
            type : "POST",
            url : prefix + "/edit",
            data : {
                "cardUserId": cardUserId,
                "cardUserName": cardUserName,
                "cardId": cardId,
                "loginName": loginName,
                "phoneNumber": phoneNumber,
                "email": email,
                "sex": sex,
                "cardStyle": cardStyle,
                "attendCount": attendCount,
                "classCount": classCount,
                "classType": classType,
                "remark": remark,
                "pastTime": pastTime,
            },
            async : false,
            error : function(request) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                $.operate.saveSuccess(data);
            }
        });
    }
</script>
<script th:src="@{/ajax/libs//datapicker/bootstrap-datepicker.js}"></script>
<script>
	$(".input-group.date").datepicker({todayBtn: "linked",keyboardNavigation: !1,forceParse: !1,calendarWeeks: !0,autoclose: !0});
</script>

</body>
</html>
